Move package settings to package instead of being tied to version#37026
Conversation
|
Originally made on top of TF state PR but I think this should go first so I don't have to bundle both into one and I can just merge this into terraform PR. |
silverwind
left a comment
There was a problem hiding this comment.
Some issues (comment written by Claude Opus 4.6):
co-authored-by: gemini3-flash
|
Why is it necessary to have two deletion buttons? |
|
You mean the one on the package version page and in settings? They are functionally different. You navigate to the package version and can go either to the package wide settings or you could delete this specific version (like before on the settings page). |
So that the button text should be different? |
add guard for the entire package deletion co-authored-by: gemini3-flash
wxiaoguang
left a comment
There was a problem hiding this comment.
Haven't fully tested, overall looks good
There was a problem hiding this comment.
Pull request overview
This PR updates Gitea’s package UX and APIs to treat “settings” and deletion as package-level concerns (not version-bound), while still supporting version deletion where appropriate. It addresses the request to delete an entire package (all versions) in one action, which is particularly relevant for package types like Terraform state.
Changes:
- Adds service/model support to delete an entire package and all its versions/files/properties in one operation.
- Adds/adjusts API routes and Swagger docs to distinguish “delete package” vs “delete package version”.
- Updates web UI routes/templates so package settings are package-scoped, and version pages offer a “delete version” modal.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/packages_service_test.go | Adds integration coverage for deleting an entire package and ensuring related properties/files/versions are removed. |
| tests/integration/api_packages_test.go | Adds API integration coverage for deleting an entire package and deleting a single package version. |
| templates/swagger/v1_json.tmpl | Documents new DELETE package endpoint and renames existing delete operation to “delete package version”. |
| templates/package/shared/view.tmpl | Updates settings link to be package-scoped; adds UI modal to delete a specific version. |
| templates/package/settings.tmpl | Makes settings page package-scoped and adds confirmation input for deleting a whole package. |
| templates/admin/packages/list.tmpl | Adjusts admin delete modal copy to reflect version deletion semantics. |
| services/packages/packages.go | Implements RemovePackage and refactors version deletion to bulk-delete version file properties/files. |
| services/packages/cleanup/cleanup.go | Notes blob deletion handling for unreferenced blobs in cleanup job. |
| services/context/package.go | Allows package assignment to resolve descriptors for package-level routes (without requiring version). |
| routers/web/web.go | Moves package settings routes out of version scope; adds POST endpoint for version deletion. |
| routers/web/user/package.go | Switches settings-page deletion to delete whole package; adds handler for version deletion. |
| routers/web/admin/packages.go | Updates flash message key for admin version deletion success. |
| routers/api/v1/packages/package.go | Adds DeletePackageVersion; changes DeletePackage to delete the whole package. |
| routers/api/v1/api.go | Adds DELETE on /packages/{owner}/{type}/{name}; routes version deletion to DeletePackageVersion. |
| options/locale/locale_en-US.json | Adds new strings for package delete confirmation and version delete messaging. |
| models/packages/package_version.go | Adds DeleteVersionsByPackageID helper. |
| models/packages/package_property.go | Adds bulk deletion helpers for properties by package/version. |
| models/packages/package_file.go | Adds bulk deletion helpers for files by package/version. |
| models/packages/descriptor.go | Adds package settings link helper and helper to load all descriptors for notifications. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
If the version is the last version of that package, should the whole package be deleted as well? Otherwise, there is no page to delete the empty package. |
|
That's cleaned up by cron task and I don't consider it in scope of this change. I do plan to go through the packages to see if I can clean it up a bit and drop query loops but that's for a later date. |
* main: Repair duration display for bad stopped timestamps (go-gitea#37121) Add terraform state registry (go-gitea#36710) Add placeholder content for empty content page (go-gitea#37114) Improve control char rendering and escape button styling (go-gitea#37094) Add gpg signing for merge rebase and update by rebase (go-gitea#36701) Move package settings to package instead of being tied to version (go-gitea#37026) Merge some standalone Vite entries into index.js (go-gitea#37085) Update Nix flake (go-gitea#37110) [skip ci] Updated translations via Crowdin Fix the wrong push commits in the pull request when force push (go-gitea#36914)



Unties settings page from package version and adds button to delete the package version
Settings page now allows for deletion of entire package and it's versions as opposed to a single version
Adds an API endpoint to delete the entire package with all versions from registry
fixes: #36904
Co-Authored-By: gemini-3-flash